<!DOCTYPE HTML>
<html th:with="title='系统设置',module='/js/app/common/uploadvideo.js'">
<head th:include="fragments/UEheader :: header">
<meta charset="utf-8" />
<style type="text/css">
/*   #insertSpe{
      margin-left:12%;
   } */
</style>
</head>
<body id="app">
	<div class="page-container">
		<form action="/manager/Setting/findAll" method="post" class="form form-horizontal" id="device-form">
			<input type="hidden" name="id" v-model="id" />
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-3">
					<span class="c-red">*</span>
					SdkAppid：
				</label>
				<div class="formControls col-xs-2 col-sm-2">
					<input type="text" class="input-text size-L" v-model="sdkAppID" id="sdkAppID" name="sdkAppID">
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-3">
					<span class="c-red">*</span>
					管理员：
				</label>
				<div class="formControls col-xs-2 col-sm-2">
					<input type="text" class="input-text size-L" v-model="root" id="root" name="root">
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-3">AccountType：</label>
				<div class="formControls col-xs-2 col-sm-2">
					<input type="text" class="input-text size-L" v-model="accountType" id="accountType" name="accountType">
				</div>
			</div>
			<div class="row cl">
				<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
					<input class="btn btn-primary size-L radius" type="submit" value="保存">
				</div>
			</div>
		</form>
	</div>

	<div th:include="fragments/widget :: multuserTreePanel"></div>
	<script th:include="fragments/widget :: multuserTreeJs" type="text/javascript">
		
	</script>
	<script type="text/javascript">
		function get() {
			$.ajax({
				type : "GET",
				url : '/manager/Setting/findAll',
				error : function(request) {
					alert("Connection error");
				},
				success : function(result) {
					if (result.status == 0) {
						var data = result.data;
						new Vue({
							el : '#device-form',
							data : data[0]
						});
					}
				}
			});
		}
		$(function() {
			get();
			$("#device-form").validate({
				rules : {
					sdkAppID : {
						required : true,
						minlength : 2,
					},
					root : {
						required : false,
						minlength : 2,
					},
					accountType : {
						required : false,
						minlength : 2,
					}
				},
				onkeyup : false,
				focusCleanup : true,
				success : "valid",
				submitHandler : function(form) {
					var data = $('#device-form').serialize();
					$.ajax({
						type : "POST",
						url : '/manager/Setting/update',
						data : data,
						error : function(request) {
							layer.alert("系统出错");
						},
						success : function(data) {
							if (data.status == 0) {
								layer.alert(data.message);
							} else {
								layer.alert(data.message);
							}
						}
					});
				}
			});
		});
	</script>
</body>
</html>